home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swags_z.zip / TEXTEDIT.SWG / 0005_WORDWRP1.PAS.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  1KB  |  69 lines

  1. {This was a Programming contest Program- BTW, this is to Van
  2. Slingerhead, not to Mike...
  3. }
  4. Program Wordwrap; 
  5. Uses Crt,Printer; 
  6. Const
  7.   max = 10; 
  8. Var
  9.   ch : Char;
  10.   arr : Array[1..800] of Char;
  11.   small,
  12.   s : String;
  13.   w,
  14.   len,
  15.   counter : Integer; 
  16. begin
  17.   w := 1;
  18.   Writeln; Writeln;
  19.   Repeat
  20.     arr[w] := ReadKey;
  21.     inc(w);
  22.     if arr[w-1] = #8 then
  23.       begin
  24.         Write(#8' '#8);
  25.         if w > 2 then
  26.           dec(w,2)
  27.         else
  28.           w:= 1;
  29.       end  { if }
  30.     else
  31.       Write(arr[w-1]);
  32.   Until arr[w-1] = #13;
  33.   arr[w-1] := ' ';
  34.  
  35.   dec(w);
  36.   Writeln; Writeln;
  37.   For counter := 1 to w do
  38.     Write(arr[counter]);
  39.  
  40.   small := '';
  41.   len := 0;
  42.   Writeln(lst);
  43.   Writeln(lst,'123456789012345678901234567890123456789012345');
  44.   Writeln(lst,'         ^         ^         ^         ^    ^');
  45.   For counter := 1 to w do
  46.     begin
  47.       if arr[counter] <> ' ' then
  48.         begin
  49.           small := small + arr[counter];
  50.           inc(len);
  51.         end
  52.       else
  53.         if len <= 45 then
  54.           begin
  55.             Write(lst,small,' ');
  56.             small := '';
  57.             inc(len);
  58.           end
  59.         else
  60.           begin
  61.             Writeln(lst);
  62.             Write(lst,small,' ');
  63.             len := length(small)+1;
  64.             small := '';
  65.           end;  { else }
  66.     end; 
  67. end.
  68.  
  69.